package edu.up.taglibs;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class ImageLinkTag extends SimpleTagSupport {

	private String link;
	private String width;
	private String img;
	
	
	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getWidth() {
		return width;
	}

	public void setWidth(String width) {
		this.width = width;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	@Override
	public void doTag() throws JspException, IOException {
		PageContext pageContext = (PageContext) getJspContext();
		try {
			JspWriter out = pageContext.getOut();
			out
					.print("<a href='"+getLink()+"'><img src='"+getImg()+"' width='"+getWidth()+"'></a>");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
